-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CARGO_TARGET_TMPDIR env var for integration tests & benches #9375
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
fda79ff
to
4753720
Compare
This seems reasonable to me! We've been hesitant to set this for things like build scripts in the past but integration tests are much more "top level" and feels more appropriate to set this information for them. @rfcbot fcp merge |
Team member @alexcrichton has proposed to merge this. The next step is review by the rest of the tagged team members: Concerns:
Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
@rfcbot concern concerns
|
Yeah, I suppose. But would that be ok for cargo itself too?
Yeah, this is what I mean with the
Oh, that should be fixed then, I'll look into it tomorrow... |
Sorry, I'm not sure I full understand the question here. Is this in reference to the |
@ehuss I'm having a hard time making the variable compile time. Setting it for compilation of integration tests/benches means it's really only available in the test/bench binaries themselves, but for example the |
Hm, that is unfortunate. I guess we could keep the runtime behavior of the current PR. Let me know if you need any help with the benchmarks. |
@ehuss Ok. No that's ok, it's easy enough to fix, I was just dealing with other stuff... I'll update the PR shortly... |
6658741
to
fa41075
Compare
Updated |
I had a chat with the rest of the team members, and we reconsidered the two issues that were brought up here, and we think we would prefer the following:
Would that work for you? It seemed from your description that you were primarily interested in a scratch directory for convenience in a test. If so, let me know if you are OK with that, and if you need or want any help. |
@ehuss Glad you had a chat & came to a decision on this, wouldn't want to rush things. And yeah, that sounds reasonable. I'll update the code to match. Probably don't need help, will ask if anything comes up 🙂 Thanks! |
fa41075
to
67fe2fe
Compare
The variable is set to $target_dir/$config/tmp This is a directory where tests & benches can place testcasei-related data for use by the tests. cargo makes sure the directory exists when building tests/benches.
67fe2fe
to
53343bc
Compare
Ok, should be ready for the next review round I think... |
Oh, nice, thanks! @rfcbot resolve concerns |
@rust-lang/cargo I have restarted the FCP since this changed a bit, and I wanted to give you a chance to re-review. Specifically: This is now Please re-check your boxes up at #9375 (comment) unless you have any concerns (such as the particular variable name, which we didn't really discuss). |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
@bors r+ |
📌 Commit 53343bc has been approved by |
☀️ Test successful - checks-actions |
Update cargo 7 commits in f3e13226d6d17a2bc5f325303494b43a45f53b7f..e51522ab3db23b0d8f1de54eb1f0113924896331 2021-04-30 21:50:27 +0000 to 2021-05-07 21:29:52 +0000 - Add CARGO_TARGET_TMPDIR env var for integration tests & benches (rust-lang/cargo#9375) - Bump to 0.55.0, update changelog (rust-lang/cargo#9464) - Some updates to the unstable documentation (rust-lang/cargo#9457) - Add CARGO_PROFILE_<name>_SPLIT_DEBUGINFO to env docs. (rust-lang/cargo#9456) - Add `report` subcommand. (rust-lang/cargo#9438) - Respect Cargo.toml `[package.exclude]` even not in a git repo. (rust-lang/cargo#9186) - Document the other crates in the codebase in the contrib guide. (rust-lang/cargo#9439)
Pkgsrc changes: * Bump bootstrap requirements to 1.53.0. * Adjust patches, adapt to upstream changes, adjust cargo checksums * If using an external llvm, require >= 10.0 Upsteream changes: Version 1.54.0 (2021-07-29) ============================ Language ----------------------- - [You can now use macros for values in built-in attribute macros.][83366] While a seemingly minor addition on its own, this enables a lot of powerful functionality when combined correctly. Most notably you can now include external documentation in your crate by writing the following. ```rust #![doc = include_str!("README.md")] ``` You can also use this to include auto-generated modules: ```rust #[path = concat!(env!("OUT_DIR"), "/generated.rs")] mod generated; ``` - [You can now cast between unsized slice types (and types which contain unsized slices) in `const fn`.][85078] - [You can now use multiple generic lifetimes with `impl Trait` where the lifetimes don't explicitly outlive another.][84701] In code this means that you can now have `impl Trait<'a, 'b>` where as before you could only have `impl Trait<'a, 'b> where 'b: 'a`. Compiler ----------------------- - [Rustc will now search for custom JSON targets in `/lib/rustlib/<target-triple>/target.json` where `/` is the "sysroot" directory.][83800] You can find your sysroot directory by running `rustc --print sysroot`. - [Added `wasm` as a `target_family` for WebAssembly platforms.][84072] - [You can now use `#[target_feature]` on safe functions when targeting WebAssembly platforms.][84988] - [Improved debugger output for enums on Windows MSVC platforms.][85292] - [Added tier 3\* support for `bpfel-unknown-none` and `bpfeb-unknown-none`.][79608] \* Refer to Rust's [platform support page][platform-support-doc] for more information on Rust's tiered platform support. Libraries ----------------------- - [`panic::panic_any` will now `#[track_caller]`.][85745] - [Added `OutOfMemory` as a variant of `io::ErrorKind`.][84744] - [ `proc_macro::Literal` now implements `FromStr`.][84717] - [The implementations of vendor intrinsics in core::arch have been significantly refactored.][83278] The main user-visible changes are a 50% reduction in the size of libcore.rlib and stricter validation of constant operands passed to intrinsics. The latter is technically a breaking change, but allows Rust to more closely match the C vendor intrinsics API. Stabilized APIs --------------- - [`BTreeMap::into_keys`] - [`BTreeMap::into_values`] - [`HashMap::into_keys`] - [`HashMap::into_values`] - [`arch::wasm32`] - [`VecDeque::binary_search`] - [`VecDeque::binary_search_by`] - [`VecDeque::binary_search_by_key`] - [`VecDeque::partition_point`] Cargo ----- - [Added the `--prune <spec>` option to `cargo-tree` to remove a package from the dependency graph.][cargo/9520] - [Added the `--depth` option to `cargo-tree` to print only to a certain depth in the tree ][cargo/9499] - [Added the `no-proc-macro` value to `cargo-tree --edges` to hide procedural macro dependencies.][cargo/9488] - [A new environment variable named `CARGO_TARGET_TMPDIR` is available.][cargo/9375] This variable points to a directory that integration tests and benches can use as a "scratchpad" for testing filesystem operations. Compatibility Notes ------------------- - [Mixing Option and Result via `?` is no longer permitted in closures for inferred types.][86831] - [Previously unsound code is no longer permitted where different constructors in branches could require different lifetimes.][85574] - As previously mentioned the [`std::arch` instrinsics now uses stricter const checking][83278] than before and may reject some previously accepted code. - [`i128` multiplication on Cortex M0+ platforms currently unconditionally causes overflow when compiled with `codegen-units = 1`.][86063] [85574]: rust-lang/rust#85574 [86831]: rust-lang/rust#86831 [86063]: rust-lang/rust#86063 [86831]: rust-lang/rust#86831 [79608]: rust-lang/rust#79608 [84988]: rust-lang/rust#84988 [84701]: rust-lang/rust#84701 [84072]: rust-lang/rust#84072 [85745]: rust-lang/rust#85745 [84744]: rust-lang/rust#84744 [85078]: rust-lang/rust#85078 [84717]: rust-lang/rust#84717 [83800]: rust-lang/rust#83800 [83366]: rust-lang/rust#83366 [83278]: rust-lang/rust#83278 [85292]: rust-lang/rust#85292 [cargo/9520]: rust-lang/cargo#9520 [cargo/9499]: rust-lang/cargo#9499 [cargo/9488]: rust-lang/cargo#9488 [cargo/9375]: rust-lang/cargo#9375 [`BTreeMap::into_keys`]: https://doc.rust-lang.org/std/collections/struct.BTreeMap.html#method.into_keys [`BTreeMap::into_values`]: https://doc.rust-lang.org/std/collections/struct.BTreeMap.html#method.into_values [`HashMap::into_keys`]: https://doc.rust-lang.org/std/collections/struct.HashMap.html#method.into_keys [`HashMap::into_values`]: https://doc.rust-lang.org/std/collections/struct.HashMap.html#method.into_values [`arch::wasm32`]: https://doc.rust-lang.org/core/arch/wasm32/index.html [`VecDeque::binary_search`]: https://doc.rust-lang.org/std/collections/struct.VecDeque.html#method.binary_search [`VecDeque::binary_search_by`]: https://doc.rust-lang.org/std/collections/struct.VecDeque.html#method.binary_search_by [`VecDeque::binary_search_by_key`]: https://doc.rust-lang.org/std/collections/struct.VecDeque.html#method.binary_search_by_key [`VecDeque::partition_point`]: https://doc.rust-lang.org/std/collections/struct.VecDeque.html#method.partition_point
This has caused a regression in beta, see #9783. |
Move `tmp` test directory. The `tmp` directory added in #9375 was placed within the profile directory (such as `target/debug/tmp` or `target/release/tmp`). This causes problems for any cargo target (binary, test, etc.) with the name `tmp` as there is a name collision. This PR attempts to address that by moving the `tmp` directory to the root of the target directory (`target/tmp`), and reserving the profile name "tmp". Fixes #9783
Move `tmp` test directory. The `tmp` directory added in rust-lang#9375 was placed within the profile directory (such as `target/debug/tmp` or `target/release/tmp`). This causes problems for any cargo target (binary, test, etc.) with the name `tmp` as there is a name collision. This PR attempts to address that by moving the `tmp` directory to the root of the target directory (`target/tmp`), and reserving the profile name "tmp". Fixes rust-lang#9783
Thanks for having a look, I was AFK for a week so I missed this issue... |
Hi.
Recently I ran into the problem that integration tests don't have a good way to figure out where
target
dir is.Knowing where
target
is is useful for integration tests that need to setup some filesystem structure for test cases. In factcargo
itself does this too (and figures out the path rather clumsily).Another popular way of doing this is to create a directory in
/tmp
(or quivalent on other systems), however, I believe using subdirectory intarget
is better as testcases are easier to debug that way and temporary locations aren't polluted.I think this would also address some concerns in #2841
Another solution might be to provide a dedicated subdirectory in
target
for this, something liketarget/scratchpad
, but I'm not convinced this is warranted... Edit: That's what was decided to do, see below...Let me know what you think 🙂